ScxV6Server.DeleteObject Method
Deletes a database object.
Parameters
- ID
The identifier of the object to delete. - Force
A flag indicating whether to force the deletion or not.
Remarks
Deletes an object from the database. If the Force flag is false, the database object is only deleted if there are no references to the deleted object. If the Force flag is true, the database object is deleted anyway and references to the deleted object are cleaned up.
The following example written in Visual Basic attempts to delete an analogue point with ID 72721.
Dim Svr As ScxV6DbClient.ScxV6Server
' Connect to the server
Svr = New ScxV6DbClient.ScxV6Server
Svr.Connect("MAIN", "", "")
Try
Svr.DeleteObject(72721, False)
Catch ex As System.Runtime.InteropServices.COMException
' Error returned, implying that the delete may have failed due to other objects referencing this one.
' Ask the user if they wish to attempt to delete anyway. Add the message returned with the exception, as
' it shows the reason the delete failed.
If (MsgBox(ex.Message + " Delete anyway?", MsgBoxStyle.OkCancel) = MsgBoxResult.Ok) Then
Svr.DeleteObject(72721, True)
End If
End Try
' Disconnect
Svr.Disconnect()